/*
 * @Description: 
 * @Autor: wanghuan
 * @Date: 2021-12-13 14:54:17
 * @LastEditors: wanghuan
 * @LastEditTime: 2021-12-14 11:55:31
 */

import config from "./config"

export function getToken_local() {
    return localStorage[config.storage_tokenKey]
}

export function setToken_local(token) {
    return localStorage[config.storage_tokenKey] = token
}

export function getUser_local(jsonAuto = true) {
    const user_local = localStorage[config.storage_userKey]
    return jsonAuto 
            ? JSON.parse( user_local || null )
            : user_local
}

export function setUser_local(user) {
    return localStorage[config.storage_userKey] = user ? JSON.stringify( user ) : user
}